{{!
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}}

<td>
  {{#if udf.isEditing}}
    {{#if udf.isEditingResource}}
      {{extended-input type="text"
                       class="pull-left form-control halfed input-sm"
                       placeholderTranslation="placeholders.fileResource.name"
                       value=udf.fileResource.name}}
      {{extended-input type="text"
                       class="pull-left form-control halfed input-sm"
                       placeholderTranslation="placeholders.fileResource.path"
                       value=udf.fileResource.path}}
    {{else}}
      {{select-widget items=fileResources
                      selectedValue=udf.fileResource
                      labelPath="name"
                      defaultLabelTranslation="placeholders.select.file"
                      itemAdded="addFileResource"
                      itemEdited="editFileResource"
                      itemRemoved="deleteFileResource"
                      canAdd=true
                      canEdit=true}}
    {{/if}}
  {{else}}
    {{#if udf.fileResource}}
      {{udf.fileResource.name}}  ({{udf.fileResource.path}})
    {{/if}}
  {{/if}}
</td>
{{#each column in columns}}
  <td>
    {{#if udf.isEditing}}
      {{extended-input type="text"
                       class="pull-left form-control input-sm"
                       placeholderTranslation=column.caption
                       dynamicContextBinding="udf"
                       dynamicValueBinding="column.property"}}
    {{else}}
      {{path-binding udf column.property}}
    {{/if}}
  </td>
{{/each}}
<td>
  {{#if udf.isEditing}}
    <div class="pull-right">
      <button type="button" class="btn btn-sm btn-warning" {{action "cancel"}}>{{t "buttons.cancel"}}</button>
      <button type="button" class="btn btn-sm btn-success" {{action "save"}}>{{t "buttons.save"}}</button>
    </div>
  {{else}}
    <div class="btn-group pull-right">
      <span data-toggle="dropdown">
        <a class="fa fa-gear"></a>
      </span>
      <ul class="dropdown-menu" role="menu">
        <li {{action 'editUdf'}}><a>{{t 'buttons.edit'}}</a></li>
        <li {{action 'deleteUdf'}}><a>{{t 'buttons.delete'}}</a></li>
      </ul>
    </div>
  {{/if}}
</td>